

import Axios from 'axios';

export default {

    async_loadFile(url){
        return new Promise(function (resolve, reject) {
            Axios.get(url).then((response)=>{
                resolve(response.data);
            }).catch((err)=>{
                reject(err);
            });
        });
    },


    async_loadFiles(lstUrl){
        let self  = this;
        return new Promise(function (resolve, reject) {
            let lstPromise = lstUrl.map(url=>{
                return self.async_loadFile(url);
            });
            Promise.all(lstPromise).then(resolve,reject);
        })

    }
}